﻿<UserControl x:Class="MTGenome.Views.FilterView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:caliburn="http://www.caliburnproject.org"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:wtk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             caliburn:Message.Attach="[Event Loaded] = [Action Loaded]">
<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <!---Note the UpdateSourceTrigger, this makes the property get changed as you type, LostFocus does otherwise
        <TextBox Text="{Binding UpdateSourceTrigger=PropertyChanged, Path=SearchText}" />-->
        <wtk:AutoCompleteBox Text="{Binding SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Path=SearchText}" 
                             ItemsSource="{Binding AutoCompleateResults}" IsTextCompletionEnabled="True" 
                             caliburn:Message.Attach="[Event TextChanged] = [Action UpdateAutoCompleateResults]"  />

        <Button caliburn:Message.Attach="Search" IsDefault="True" Grid.Column="1">Search</Button>

       
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Grid.Row="1" Grid.ColumnSpan="2">
        <StackPanel Margin="10">
            <TextBlock FontWeight="Bold" Text="Colors:" />
            <CheckBox FontStyle="Italic" IsChecked="{Binding AnyColor}">Any Color?</CheckBox>
            <StackPanel Visibility="{Binding Converter={StaticResource {x:Type BooleanToVisibilityConverter}}, Path=NotAnyColor}">
                <CheckBox IsChecked="{Binding Black}">Black</CheckBox>
                <CheckBox IsChecked="{Binding Blue}">Blue</CheckBox>
                <CheckBox IsChecked="{Binding White}">White</CheckBox>
                <CheckBox IsChecked="{Binding Green}">Green</CheckBox>
                <CheckBox IsChecked="{Binding Red}">Red</CheckBox>
                <CheckBox IsChecked="{Binding Colorless}">Colorless</CheckBox>
            </StackPanel>
            <TextBlock FontWeight="Bold" Text="Card Types:" />
            <CheckBox IsChecked="{Binding AnyType}" FontStyle="Italic">Any Type?</CheckBox>
            <StackPanel Visibility="{Binding Converter={StaticResource {x:Type BooleanToVisibilityConverter}}, Path=NotAnyType}">
                <CheckBox IsChecked="{Binding Artifacts}">Artifacts</CheckBox>
                <CheckBox IsChecked="{Binding Creatures}">Creatures</CheckBox>
                <CheckBox IsChecked="{Binding Enchantments}">Enchantments</CheckBox>
                <CheckBox IsChecked="{Binding Instants}">Instants</CheckBox>
                <CheckBox IsChecked="{Binding Lands}">Lands</CheckBox>
                <CheckBox IsChecked="{Binding Sorceries}">Sorceries</CheckBox>
                <CheckBox IsChecked="{Binding Plainswalkers}">Plainswalkers</CheckBox>
            </StackPanel>
            <TextBlock FontWeight="Bold" Text="Expansions:" />
            <CheckBox FontStyle="Italic" IsChecked="{Binding AnyExpansion}">Any Expansion?</CheckBox>
            <ItemsControl ItemsSource="{Binding Expansions}" Visibility="{Binding Converter={StaticResource {x:Type BooleanToVisibilityConverter}}, Path=NotAnyExpansion}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding Mode=TwoWay, Path=IsChecked}">
                            <TextBlock Text="{Binding Name}" />
                        </CheckBox>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>
    </ScrollViewer>
    </Grid>
</UserControl>
